<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>首页</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
		<style>
		    html,body{
		    	margin:0;
		    	padding: 10px 10px 0 10px;
		    	width:100%;
				height:100%;
				box-sizing: border-box;
		    }
			.main{
				width:100%;
				height:100%;
    			/* text-align:center; */
				overflow: hidden;
			}
			.mainTitle{
				color: #f58843;
				font-size: 30px;
				height: 100px;
				line-height: 100px;
				margin-top: 20%;
				
			}
			.mainLabel{
				color: #999;
				font-size: 16px;
			}
			
			/* 待办 */
			.stayWork{
				width:500px;
				height:500px;
				margin:100px auto;
				display: none;
			}
			.stay-list{
				padding: 10px 15px;
				background-color: #f8f8f8;
				color: #999;
				border-radius: 2px;
				margin:5px;
				display: flex;
				justify-content: space-between;
				height:50px;
				line-height:50px;
				cursor:pointer
			}
			.stay-list p cite {
			    font-style: normal;
			    font-size: 30px;
			    font-weight: 300;
			    color: #f58843;
			}
			.stay_goods,.stay_supplier,.stay_restaurant{
				display: none;
			}
		</style>
	</head>

	<body>
		<div class="main">
			<!-- <div class="mainTitle">
				喜餐订货管理系统
			</div>
			<div class="mainLabel">
				欢迎你
			</div> -->
			<div class="stayWork">
			<div class="layui-card">
			  <div class="layui-card-header">待办列表</div>
			  <div class="layui-card-body">
				<div class="stay_goods">
					<div class="stay-list">
						<div class="stay-left">
							<a lay-href="app/content/comment.html" class="layadmin-backlog-body">
							  <h3>待审核商品数</h3>
							</a>
						</div>
						<div class="stay-right">
							<p><cite></cite></p>
						</div>
					</div>
				</div>
				<div class="stay_supplier">
					<div class="stay-list">
						<div class="stay-left">
							<a lay-href="app/content/comment.html" class="layadmin-backlog-body">
							<h3>待审核供应商数</h3>
							</a>
						</div>
						<div class="stay-right">
							<p><cite></cite></p>
						</div>
					</div>
				</div> 
				<div class="stay_restaurant">
					<div class="stay-list">
						<div class="stay-left">
							<a lay-href="app/content/comment.html" class="layadmin-backlog-body">
							<h3>待审核餐饮总部数</h3>
							</a>
						</div>
						<div class="stay-right">
							<p><cite></cite></p>
						</div>
					</div>
				</div>
			  </div>
			</div>
		  </div>
			
		</div>
		<script type="text/javascript" src="plugins/layui/layui.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script>
		    layui.config({
		        base: 'plugins/layui/modules/',
		    }).use(['http', 'form'], function() {
		        var http = layui.http,
		            form = layui.form;
		
				var authorities = localStorage.getItem('xi-can-management-userInfo')
				if(authorities) {
					authorities = JSON.parse(authorities)
					authorities = authorities.authorities
				}
				var supplierAccount = false,cateringAccount = false,productManagement = false
				for(var i=0;i<authorities.length;i++){
					var name = authorities[i].href
					if(name){
						switch(name){
							case 'supplierAccount.html':
								supplierAccount = true
								break
							case 'cateringAccount.html':
								cateringAccount = true
								break
							default:
								break
						}
					}else if(authorities[i].title == '商品管理'){
						for(var j=0;j<authorities[i].children.length;j++){
							var name = authorities[i].children[j].href
							if(name == 'productManagement.html'){
								productManagement = true
							}
						}
					}
				}
				if(!supplierAccount&&!cateringAccount&&!productManagement){
					
				}else{
					$('.stayWork').show()
					if(supplierAccount){
						$('.stay_supplier').show()
					}
					if(cateringAccount){
						$('.stay_restaurant').show()
					}
					if(productManagement){
						$('.stay_goods').show()
					}
					http.get('admin/count/review',{},function(res){
						if(res.code == 200){
							$('.stay_goods cite').html(res.data.productReviewCount);
							$('.stay_supplier cite').html(res.data.supplierReviewCount);
							$('.stay_restaurant cite').html(res.data.foodManagerReviewCount);
						}else{
							layer.msg(res.msg)
						}
					})
					
					// 待审核商品数
					$('.stay_goods').click(function(){
						sessionStorage.setItem('xi-can-management-productMSearch', JSON.stringify({
							reviewStatus: '0'
						}))
						location.href = "productManagement.html"
					})

					// 待审核供应商数
					$('.stay_supplier').click(function(){
						location.href = "supplierAccount.html?reviewStatus=0"
					})

					// 待审核餐饮总部数
					$('.stay_restaurant').click(function(){
						location.href = "cateringAccount.html?reviewStatus=0"
					})

				}
		
		    })
		</script>
	</body>
</html>